/**
 * @file  height_pid.h
 *
 * @brief  PID functions to control the height of the blimp
 *
 * CSC 460 Mantis Cheng Fall 2007
 *
 * @author Scott Craig
 * @author Justin Tanner
 */

#ifndef __HEIGHT_PID_H__
#define __HEIGHT_PID_H__

#include <avr/io.h>
#include <stdint.h>
#include "sonar.h"

/** Proportional multiplier. */
#define HEIGHT_KP                  15
 
/** Differential multiplier. */
#define HEIGHT_KD                  5

/** Target height in inches. */
#define HEIGHT_SET_POINT    24

/** Set motor duty to 0 below this pid value. */
#define HEIGHT_PID_CUTOFF          10

/** Minimum duty to apply to motor to overcome motor inertia. */
#define HEIGHT_PID_MIN_DUTY        25

/** The height of the blimp from 6 to 255 inches. */
extern uint8_t height;

int16_t height_pid(void);
int16_t height_scale(int16_t pid);
void height_pid_init(void);
void setheight(int joystick_height);

uint8_t getHeight();

#endif
